import requests
import json
#gat 请求
# r = requests.get("http://www.webxml.com.cn/WebServices/WeatherWS.asmx/getSupportCityDataset?theRegionCode=北京")
# print(r.text)

# response = requests.get(url='http://ws.webxml.com.cn//WebServices/WeatherWS.asmx/getRegionProvince?')
# print (response.text)


# url ='http://ws.webxml.com.cn/WebServices/WeatherWS.asmx/getSupportCityString'
# params = {'theRegionCode':31123}
# response = requests.get(url,params=params)
# print (response.text)


#post 请求

# url ='http://ws.webxml.com.cn/WebServices/WeatherWS.asmx/getSupportCityString'
# headers = {'Content-Type': 'application/x-www-form-urlencoded','Content-Length': 'length',}
# params = {'theRegionCode':31123}
# response = requests.post(url,data=params,headers=headers)
# print(response.text)

#xml 格式

url ='http://ws.webxml.com.cn/WebServices/WeatherWS.asmx'  #xml请求地址
headers = {'Content-Type': 'text/xml; charset=utf-8','Content-Length': 'length',}
#xml请求格式
params = '''<?xml version="1.0" encoding="utf-8"?>
<soap:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
  <soap:Body>
    <getSupportCityString xmlns="http://WebXml.com.cn/">
      <theRegionCode>31123</theRegionCode>
    </getSupportCityString>
  </soap:Body>
</soap:Envelope>'''

response = requests.post(url,data=params,headers=headers)
print(response.text)


#json 格式
